package com.oocl.ita.sakura.client;

import java.io.Serializable;
import java.net.Socket;
import java.util.UUID;

public class Client implements Serializable {
	// private UUID uid; // 如果不保存socket，就要有这个，保证hashCode重写后是唯一的
	private String account;
	// private Socket clientSocket; // socket 要不要在这里？ 好处？ 坏处？

	/*
	 * 加字段需要更改equals和hashCode方法
	 */

	public Client() {
		super();
	}

	public Client(String accout) {
		super();
		this.account = accout;
	}

	public String getAccout() {
		return account;
	}

	// public UUID getUid() {
	// return uid;
	// }
	//
	// public void setUid(UUID uid) {
	// this.uid = uid;
	// }

	public void setAccout(String accout) {
		this.account = accout;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((account == null) ? 0 : account.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Client other = (Client) obj;
		if (account == null) {
			// if (other.accout != null)--
			return false;
		} else if (!account.equals(other.account))
			return false;
		return true;
	}

	@Override
	public String toString() {
//		return "Client [accout=" + accout + "]";
		return account;
	}	
}
